package iscript.uiFramework.components.panel
{
	import flash.display.BitmapData;
	import iscript.uiFramework.components.layout.LayoutMargin;
	import iscript.uiFramework.components.text.Label;
	import iscript.uiFramework.components.toolbar.Toolbar;
	import iscript.uiFramework.components.toolButton.MinButton;
	import iscript.uiFramework.components.UIComponent;
	import iscript.uiFramework.UIFramework;
	
	public class PanelHeader extends UIComponent
	{
		
		private var _headBar:Toolbar;
		private var _headBg:BitmapData;
		private var _label:Label;
		internal var expandButton:MinButton = new MinButton();
		
		public function PanelHeader()
		{
			
		}
		
		override protected function initialize():void 
		{
			_headBar = new Toolbar(400, 26);
			_headBar.LeftHBox.getLayout().margin = new LayoutMargin(4, 2, 2, 2);
			_headBar.render(this);
			_headBg = UIFramework.resource.getBitmapData("GameLite.UIComponent." + this.theme + ".Panel.Header");
			_headBar.background = true;
			_headBar.getBackground().begFill(_headBg);
			
			_label = new Label();
			_label.text = "Title";
			_label.size = 12;
			_label.color = 0x15428B;
			_label.bold = true;

			_headBar.addCmpLeft(_label);
				
			
		   _headBar.addCmpRight(expandButton);	
		   
		   
		    border = true;
			getBorder().topVisible = false;
			getBorder().leftVisible = false;
			getBorder().rightVisible = false;
			getBorder().color = 0x99BBE8;
			
			super.initialize();
		}
		
		
		override public function set width(value:Number):void 
		{
			super.width = value;
			_headBar.width = value;
		}
		
		
		public function get icon():BitmapData 
		{
			return _label.icon;
		}
		
		public function set icon(value:BitmapData):void 
		{
			_label.icon = value;
		}
		
		public function get text():String 
		{
			return _label.text;
		}
		
		public function set text(value:String):void 
		{
			_label.text = value;
		}
	
	}

}